1. Technology Field
The present invention generally relates to a memory erasing method, and more particularly, to a memory erasing method which can effectively execute an erase command on memory cells storing invalid data, and a memory controller and a memory storage apparatus using the same.
2. Description of Related Art
Along with the widespread of digital cameras, cell phones, and MP3 in recently years, the consumers' demand to storage media has increased drastically. Rewritable non-volatile memory is one of the most adaptable storage media to portable electronic products (for example, notebook computers) due to its many characteristics such as data non-volatility, low power consumption, small volume, non-mechanical structure, and high access speed. A solid state drive (SSD) is a storage apparatus which uses a flash memory as its storage medium. Thus, in recent years, the flash memory industry has become a major part of the electronic industry.
A sub memory module of a rewritable non-volatile memory module has a plurality of physical blocks, and each of the physical blocks has a plurality of physical pages. While writing data into a physical block, the data has to be written according to the sequence of the physical pages. Besides, a physical page already containing data should be erased before it is used for writing new data. In particular, each physical block is the smallest unit for erasing data, and each physical page is the smallest unit for programming (i.e., writing) data. In the management of a flash memory module, physical blocks are grouped into a data area and a spare area.
Physical blocks (also referred to as data physical blocks) in the data area are physical blocks already containing data and mapped to logical blocks. To be specific, a memory management circuit of a memory storage apparatus converts a logical access address to be accessed by a host system into a logical page of a logical block, writes the data to be written into a physical page of a specific physical block, and maps the logical page of the logical block to the physical page of the physical block. Namely, in the management of a rewritable non-volatile memory module, the physical blocks in the data area are considered used physical blocks (for example, already containing data written by a host system). For example, the memory management circuit records the mapping relationship between the logical blocks and the physical blocks in the data area in a logical block-physical block mapping table, wherein the logical pages in a logical block are sequentially mapped to the physical pages in the corresponding physical block.
Physical blocks (also referred to as spare physical blocks) in the spare area are used for substituting the physical blocks in the data area. To be specific, as described above, a physical block already containing data has to be erased before it can be used for writing new data. Thus, the physical blocks in the spare area are used for writing update data and substituting the physical blocks originally mapped to logical blocks.
Namely, in the management of a rewritable non-volatile memory module, the physical pages of the physical blocks in the data area and the spare area are alternatively mapped to the logical pages of the logical blocks for storing data written by a host system. In particular, during the operation of a memory storage apparatus, a writing operation may be aborted due to a power failure, and accordingly incomplete data may be stored in a physical block in the spare area. Thus, in an existing design, when the memory storage apparatus is powered on, a memory controller of the memory storage apparatus executes an erase command on the physical blocks in the spare area to ensure that the physical blocks in the spare area have all been erased, so as to avoid double programming.
However, along with the increase in the capacity of rewritable non-volatile memory module, it takes a very long time to execute the erase command on all the physical blocks in the spare area. Thus, after powering on a memory storage apparatus, a user has to wait for a very long time before the user can access the memory storage apparatus.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.